home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Modem / LineShare⁄ZyXEL Folder / ZyXEL Fax&MultiData < prev    next >
Text File  |  1992-12-25  |  6KB  |  278 lines

  1. !
  2. ! LineShare™ Script for ZyXEL U-1496 modems
  3. !
  4. ! This script is designed to use with fax and several data services:
  5. ! TeleFinder™ BBS ("TF" subPort)
  6. ! QuickMail™ MailServer ("Mail" subPort)
  7. ! The script displays the menu: this lines are marked with "@@@"
  8. ! The choice is done manually by the user when connecting to the host.
  9. !
  10. ! For some reasons TeleFinder redefines the LineFeed character (S4)
  11. ! We don't redefine it really, but we emulate modem responses with that symbol
  12. ! This trick is done in lines marked with '$$$$'
  13. !
  14. ! If you want to modify this script for your modem, pay attention to
  15. ! the line marked "#### Settings ####" - it should be modified first
  16. !
  17. ! The TeleFinder "Host Options" used:
  18. ! "Adjust BPS to line speed" - *disabled* (since we alsways return "CONNECT 19200")
  19. ! "Use Break Reset" - *enabled*,
  20. !
  21. ! The QuickMail options (through CTB module:)
  22. ! Don't adjust speed (since we alsways return "CONNECT 19200")
  23. !
  24. !
  25.  
  26. ! ------------------------------------------
  27. ! Resetting the modem:
  28. ! ------------------------------------------
  29. @Hangup
  30.   SetTries 2
  31.   Flush
  32.   HsReset 0,0,17,19,0,0
  33. !
  34. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  35. ! to enter the command mode
  36. !
  37. @Label 1
  38.   matchclr
  39.   matchstr 1 2 "OK\r\n"
  40.   write "ATH0&F\r"
  41.   matchread 20
  42.   Write "+++"
  43.   DtrClear
  44.   pause 10
  45.   DtrSet
  46. !
  47.   DecTries
  48.   IfTries 0 1
  49. !
  50. ! OSErr -6019 "Modem error - the modem is not responding"
  51. !
  52.   exit -6019
  53. @Label 2
  54.   write "AT+FCLASS=0\r"
  55.   Jsr 100
  56.   write "AT+FAA=0\r"
  57.   Jsr 100
  58.   exit 0
  59. ! ------------------------------------------
  60. !    Receiving incoming calls
  61. ! ------------------------------------------
  62. @ANSWER
  63. @Label 10
  64. !
  65. ! Set the modem preferred speed first
  66. !
  67.   SERRESET 2400,0,8,1
  68.   Jsr 80
  69. !
  70. ! Set the common options
  71.   Jsr 70
  72. !
  73. ! Set the communication options:
  74. ! Extended response set
  75. ! &K4 - Enable MNP for TeleFinder and mail
  76. ! &H4 - Xon/Xoff flow control (for Fax)
  77. ! Fax mode (to enable fax tuning commands)
  78. !
  79. @Label 11
  80. ! #### Settings ####
  81.   Write "ATX4&H4&K4+FCLASS=2\r"
  82.   Jsr 100
  83. !
  84. ! Set the "work" speed
  85. !
  86. @Label 12
  87.   SERRESET 19200,0,8,1
  88.   Jsr 80
  89. !
  90. ! Set Fax parameters: LID, DCC,BOR
  91. !
  92.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  93.   Jsr 100
  94.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  95.   Jsr 100
  96.   Write "AT+FBOR=1\r"
  97.   Jsr 100
  98. !
  99. ! Allow modem to receive fax messages
  100. !
  101.   Write "AT+FCR=1\r"
  102.   Jsr 100
  103. !
  104. ! Tell the modem to determine the type of the incoming call
  105. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  106. !
  107.   Write "ATS0=^4+FAA=1\r"
  108.   Jsr 100
  109. !
  110. ! Everything is ready - let's sit and wait for a call
  111. ! We'll wait for 2 minutes, then reinitiate the modem
  112. @Label 20
  113.   MatchClr
  114.   matchstr 1 20 "RING\r"
  115.   matchstr 2 21 "CONNECT"
  116.   matchstr 13 30 "+FCON"
  117.   matchstr 14 10 "\r\nNO  "
  118.   matchstr 15 10 "BUSY"
  119.   Matchread 1200
  120.   jump 10
  121. !
  122. ! Data connection has been established (we read "CONNECT")
  123. ! Remove everything till "\r\n" from the buffer
  124. @Label 21
  125.   MatchClr
  126.   MatchStr 1 22 "\r\n"
  127.   MatchRead 10
  128.   exit -6019
  129. @Label 22
  130. !
  131. ! Display our menu
  132. ! @@@
  133.   Write "\r\n\n\n\nWelcome to Stalker Multi-Service Host!\r\n"
  134.   Write "\r\nPress a key to connect to:\r\n"
  135.   Write "M - TeleFinder(tm) BBS\r\n"
  136.   Write "Q - QuickMail(tm) mail-server\r\n"
  137.   Write "=>"
  138.   MatchClr
  139.   MatchStr 1 24 "M"
  140.   MatchStr 2 24 "m"
  141.   MatchStr 3 25 "Q"
  142.   MatchStr 4 25 "q"
  143.   MatchStr 5 23 "\r"
  144.   MatchRead 150
  145. @Label 23
  146.   exit -6019
  147. !
  148. ! Emulate the CONNECT 19200 message
  149. ! Attach the "TF" subPort
  150. ! The letter "M" is also put into the buffer,
  151. ! since it could be part of TeleFinder "MMM" 'entry mark'
  152. !
  153. @Label 24
  154.   Write "M\r\n\r\nConnecting to TeleFinder...\r\n"
  155.   QueueInput "\r\27CONNECT 19200\r\27M"
  156.   Attach "TF" (DTR,BREAK,RESET,ESCAPE,IDLELIMIT=60)
  157. !
  158. ! Emulate the CONNECT 19200 message
  159. ! Attach the "Mail" subPort
  160. ! The symbol "\r" is also put into the buffer,
  161. ! to force QuickMail to start the session
  162. !
  163. @Label 25
  164.   Write "Q\r\n\r\nConnecting to QuickMail...\r\n"
  165.   QueueInput "\r\nCONNECT 19200\r\n\r"
  166.   Attach "Mail" (DTR,ESCAPE)
  167. !
  168. ! Fax connection has been established (we read "+FCON")
  169. ! Put the +FCON back to the buffer,
  170. ! Put the "RING" before the "+FCON"
  171. ! Attach the "Fax" subPort
  172. !
  173. @Label 30
  174.   QueueInput "\r\nRING\r\n\r\n+FCON"
  175.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  176. ! ------------------------------------------
  177. ! Originating a call through the "Fax" subPort
  178. ! ------------------------------------------
  179. @ORIGINATE "Fax"
  180. !
  181. ! Set the "Fax" speed
  182. !
  183.   SERRESET 19200,0,8,1
  184.   Jsr 80
  185. !
  186. ! Set the common options
  187. !
  188.   Jsr 70
  189. !
  190. ! Set the Fax mode
  191. !
  192.   Write "AT+FCLASS=2\r"
  193.   Jsr 100
  194. !
  195. ! Now emit all commands that the application has sent to that port,
  196. ! Prepare to receive all error result codes
  197. !
  198. !EmitClear "S","S","S","&","&","\\","\\"
  199.   Jsr 60
  200. !
  201. ! Prepare to connect
  202. !
  203.   Jsr 90
  204.   MatchStr 1 51 "\r\n+FCON"
  205.   HsReset *
  206.   Write "ATD^1\r"
  207.   MatchRead 700
  208.   Write "\r"
  209.   Exit -6019
  210. @LABEL 51
  211.   QueueInput "\r\n+FCON"
  212.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  213. !
  214. ! This section emits all modem commands sent by the client application
  215. ! For each set of commands the "OK" answer is awaited
  216. !
  217. @Label 60
  218.   EmitStart
  219. @Label 61
  220.   EmitCommand 62
  221.   Jsr 100
  222.   Jump 61
  223. @Label 62
  224.   return
  225. !
  226. ! This section initiates the modem before ANSWER and ORIGINATEs:
  227. ! factory settings + speaker control +
  228. ! reset on Dtr drop + DCD valid
  229. ! Verbal responses mode, no echo 
  230. ! Set &S1 (DSR) in case the cable connects the DSR signal with the CTS pin
  231. !
  232. @Label 70
  233.   Write "ATM^2L^3&D2&C1V1E0\r"
  234.   Jsr 100
  235.   return 
  236. !
  237. ! This section syncronize the modem after the serial port speed switching
  238. !
  239. @Label 80
  240.   ChrDelay 1
  241.   Write "AT\r"
  242.   ChrDelay 0
  243.   Jsr 100
  244.   return
  245. !
  246. ! Prepare to receive error result codes
  247. !
  248. @Label 90
  249.   MatchClr
  250.   MatchStr 2 91 "NO DIALTONE\r\n"
  251.   MatchStr 3 92 "BUSY\r\n"
  252.   MatchStr 4 93 "NO CARRIER\r\n"
  253.   MatchStr 5 94 "NO ANSWER\r\n"
  254.   return
  255. @Label 91
  256.   exit -6020
  257. @Label 92
  258.   exit -6022
  259. @Label 93
  260.   exit -6021
  261. @Label 94
  262.   exit -6023
  263. !
  264. ! Processing the AT command:
  265. ! OK -> proceed
  266. ! ERROR or TimeOut ->exit -6019
  267. ! It can be called AFTER the "Write" command, since LineShare buffers input
  268. !
  269. @Label 100
  270.   MatchClr
  271.   MatchStr 1 102 "\r\nOK\r\n"
  272.   MatchStr 2 101 "\r\nERROR\r\n"
  273.   MatchRead 20
  274. @Label 101
  275.   Exit -6019
  276. @Label 102
  277.   return
  278.